package com.xn.myyxcampus.fragment;



import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.lidroid.xutils.util.LogUtils;
import com.xn.myyxcampus.MainActivity;
import com.xn.myyxcampus.MyApplication;

public abstract class BaseFragment extends Fragment {

	protected View view;
	protected Context ct = MyApplication.getContext();
	protected boolean flag = false;
	protected AnimationDrawable animationDrawable;

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onActivityCreated(savedInstanceState);
		initData(savedInstanceState);
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		LogUtils.customTagPrefix = "tracy";
		//关闭log.i的输出
		//LogUtils.allowI = false;
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		view = initView(inflater);	
		return view;
	}

	public View getRootView() {
		return view;
	}
	
	
	/**
	 * 现实左侧侧滑菜单
	 */
	protected void showLeft() {
		// TODO Auto-generated method stub
		if(getActivity() instanceof MainActivity) {
			((MainActivity)getActivity()).showMenu();
		}
	}
	/**
	 * 
	 * @param inflater
	 * @return
	 */
	public abstract View initView(LayoutInflater inflater);
	/**
	 *
	 * @param savedInstanceState
	 */
	public abstract void initData(Bundle savedInstanceState);
	
}
